<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Class: Ram::Compressor
  
    &mdash; Jammit
  
</title>

  <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />

  <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  relpath = '..';
  if (relpath != '') relpath += '/';
</script>

  <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>


  </head>
  <body>
    <script type="text/javascript" charset="utf-8">
      if (window.top.frames.main) document.body.className = 'frames';
    </script>
    
    <div id="header">
      <div id="menu">
  
    <a href="../_index.html">Index (C)</a> &raquo; 
    <span class='title'><span class='object_link'><a href="../Ram.html" title="Ram (module)">Ram</a></span></span>
     &raquo; 
    <span class="title">Compressor</span>
  
  
  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a id="class_list_link" href="#">Class List</a>
  
    <a id="method_list_link" href="#">Method List</a>
  
    <a id="file_list_link" href="#">File List</a>
  
</div>
      <div class="clear"></div>
    </div>
    
    <iframe id="search_frame"></iframe>
    
    <div id="content"><h1>Class: Ram::Compressor
  
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName">Object</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">Ram::Compressor</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
  
  
  
    <dt class="r2 last">Defined in:</dt>
    <dd class="r2 last">lib/jammit/compressor.rb</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    <p>Uses the <span class="caps">YUI</span> Compressor or Closure Compiler to compress JavaScript.
Always uses <span class="caps">YUI</span> to compress <span class="caps">CSS</span> (Which means that Java must be installed.)
Also knows how to create a concatenated <span class="caps">JST</span> file.
If &#8220;embed_assets&#8221; is turned on, creates &#8220;mhtml&#8221; and &#8220;datauri&#8221; versions of
all stylesheets, with all enabled assets inlined into the css.</p>

  </div>
</div>
<div class="tags">
  

</div>
  <h2>Constant Summary</h2>
  
    <dl class="constants">
      
        <dt id="EMBED_MIME_TYPES-constant" class="">EMBED_MIME_TYPES =
          <div class="docstring">
  <div class="discussion">
    <p>Mapping from extension to mime-type of all embeddable assets.</p>

  </div>
</div>
<div class="tags">
  

</div>
        </dt>
        <dd><pre class="code"><span class='lbrace'>{</span>
  <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>.png</span><span class='tstring_end'>'</span></span>  <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>image/png</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
  <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>.jpg</span><span class='tstring_end'>'</span></span>  <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>image/jpeg</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
  <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>.jpeg</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>image/jpeg</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
  <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>.gif</span><span class='tstring_end'>'</span></span>  <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>image/gif</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
  <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>.tif</span><span class='tstring_end'>'</span></span>  <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>image/tiff</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
  <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>.tiff</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>image/tiff</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
  <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>.ttf</span><span class='tstring_end'>'</span></span>  <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>font/truetype</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
  <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>.otf</span><span class='tstring_end'>'</span></span>  <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>font/opentype</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
  <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>.woff</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>font/woff</span><span class='tstring_end'>'</span></span>
<span class='rbrace'>}</span></pre></dd>
      
        <dt id="EMBED_EXTS-constant" class="">EMBED_EXTS =
          <div class="docstring">
  <div class="discussion">
    <p>Font extensions for which we allow embedding:</p>

  </div>
</div>
<div class="tags">
  

</div>
        </dt>
        <dd><pre class="code"><span class='const'>EMBED_MIME_TYPES</span><span class='period'>.</span><span class='id keys'>keys</span></pre></dd>
      
        <dt id="EMBED_FONTS-constant" class="">EMBED_FONTS =
          
        </dt>
        <dd><pre class="code"><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>.ttf</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>.otf</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>.woff</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span></pre></dd>
      
        <dt id="MAX_IMAGE_SIZE-constant" class="">MAX_IMAGE_SIZE =
          <div class="docstring">
  <div class="discussion">
    <p>(32k &#8211; padding) maximum length for data-uri assets (an IE8 limitation).</p>

  </div>
</div>
<div class="tags">
  

</div>
        </dt>
        <dd><pre class="code"><span class='int'>32700</span></pre></dd>
      
        <dt id="EMBED_DETECTOR-constant" class="">EMBED_DETECTOR =
          <div class="docstring">
  <div class="discussion">
    <p><span class="caps">CSS</span> asset-embedding regexes for <span class="caps">URL</span> rewriting.</p>

  </div>
</div>
<div class="tags">
  

</div>
        </dt>
        <dd><pre class="code"><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>url\(['&quot;]?([^\s)]+\.[a-z]+)(\?\d+)?['&quot;]?\)</span><span class='regexp_end'>/</span></span></pre></dd>
      
        <dt id="EMBEDDABLE-constant" class="">EMBEDDABLE =
          
        </dt>
        <dd><pre class="code"><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>[\A\/]embed\/</span><span class='regexp_end'>/</span></span></pre></dd>
      
        <dt id="EMBED_REPLACER-constant" class="">EMBED_REPLACER =
          
        </dt>
        <dd><pre class="code"><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>url\(__EMBED__(.+?)(\?\d+)?\)</span><span class='regexp_end'>/</span></span></pre></dd>
      
        <dt id="MHTML_START-constant" class="">MHTML_START =
          <div class="docstring">
  <div class="discussion">
    <p><span class="caps">MHTML</span> file constants.</p>

  </div>
</div>
<div class="tags">
  

</div>
        </dt>
        <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/*\r\nContent-Type: multipart/related; boundary=\&quot;MHTML_MARK\&quot;\r\n\r\n</span><span class='tstring_end'>&quot;</span></span></pre></dd>
      
        <dt id="MHTML_SEPARATOR-constant" class="">MHTML_SEPARATOR =
          
        </dt>
        <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>--MHTML_MARK\r\n</span><span class='tstring_end'>&quot;</span></span></pre></dd>
      
        <dt id="MHTML_END-constant" class="">MHTML_END =
          
        </dt>
        <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\r\n--MHTML_MARK--\r\n*/\r\n</span><span class='tstring_end'>&quot;</span></span></pre></dd>
      
        <dt id="JST_START-constant" class="">JST_START =
          <div class="docstring">
  <div class="discussion">
    <p><span class="caps">JST</span> file constants.</p>

  </div>
</div>
<div class="tags">
  

</div>
        </dt>
        <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>(function(){</span><span class='tstring_end'>&quot;</span></span></pre></dd>
      
        <dt id="JST_END-constant" class="">JST_END =
          
        </dt>
        <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>})();</span><span class='tstring_end'>&quot;</span></span></pre></dd>
      
        <dt id="COMPRESSORS-constant" class="">COMPRESSORS =
          
        </dt>
        <dd><pre class="code"><span class='lbrace'>{</span>
  <span class='symbol'>:yui</span>      <span class='op'>=&gt;</span> <span class='const'>YUI</span><span class='op'>::</span><span class='const'>JavaScriptCompressor</span><span class='comma'>,</span>
  <span class='symbol'>:closure</span>  <span class='op'>=&gt;</span> <span class='const'>Ram</span><span class='period'>.</span><span class='id compressors'>compressors</span><span class='period'>.</span><span class='id include?'>include?</span><span class='lparen'>(</span><span class='symbol'>:closure</span><span class='rparen'>)</span>  <span class='op'>?</span> <span class='const'>Closure</span><span class='op'>::</span><span class='const'>Compiler</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span>
  <span class='symbol'>:uglifier</span> <span class='op'>=&gt;</span> <span class='const'>Ram</span><span class='period'>.</span><span class='id compressors'>compressors</span><span class='period'>.</span><span class='id include?'>include?</span><span class='lparen'>(</span><span class='symbol'>:uglifier</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='const'>Ram</span><span class='op'>::</span><span class='const'>Uglifier</span>  <span class='op'>:</span> <span class='kw'>nil</span>
<span class='rbrace'>}</span></pre></dd>
      
        <dt id="DEFAULT_OPTIONS-constant" class="">DEFAULT_OPTIONS =
          
        </dt>
        <dd><pre class="code"><span class='lbrace'>{</span>
  <span class='symbol'>:yui</span>      <span class='op'>=&gt;</span> <span class='lbrace'>{</span><span class='symbol'>:munge</span> <span class='op'>=&gt;</span> <span class='kw'>true</span><span class='rbrace'>}</span><span class='comma'>,</span>
  <span class='symbol'>:closure</span>  <span class='op'>=&gt;</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span>
  <span class='symbol'>:uglifier</span> <span class='op'>=&gt;</span> <span class='lbrace'>{</span><span class='symbol'>:copyright</span> <span class='op'>=&gt;</span> <span class='kw'>false</span><span class='rbrace'>}</span>
<span class='rbrace'>}</span></pre></dd>
      
    </dl>
  





  
    <h2>
      Instance Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="private ">
  <span class="summary_signature">
    
      <a href="#absolute_path-instance_method" title="#absolute_path (instance method)">- (Object) <strong>absolute_path</strong>(asset_pathname, css_pathname) </a>
    

    
  </span>
  
  
  <span class="note title private">private</span>
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Get the site-absolute public path for an asset file path that may or may
not be relative, given the path of the stylesheet that contains it.</p></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#compile_jst-instance_method" title="#compile_jst (instance method)">- (Object) <strong>compile_jst</strong>(paths) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Compiles a single <span class="caps">JST</span> file by writing out a javascript that adds
template properties to a top-level template namespace object.</p></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#compress_css-instance_method" title="#compress_css (instance method)">- (Object) <strong>compress_css</strong>(paths, variant = nil, asset_url = nil) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Concatenate and compress a list of <span class="caps">CSS</span> stylesheets.</p></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#compress_js-instance_method" title="#compress_js (instance method)">- (Object) <strong>compress_js</strong>(paths) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Concatenate together a list of JavaScript paths, and pass them through the
<span class="caps">YUI</span> Compressor (with munging enabled).</p></div></span>
  
</li>

      
        <li class="private ">
  <span class="summary_signature">
    
      <a href="#concatenate-instance_method" title="#concatenate (instance method)">- (Object) <strong>concatenate</strong>(paths) </a>
    

    
  </span>
  
  
  <span class="note title private">private</span>
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Concatenate together a list of asset files.</p></div></span>
  
</li>

      
        <li class="private ">
  <span class="summary_signature">
    
      <a href="#concatenate_and_tag_assets-instance_method" title="#concatenate_and_tag_assets (instance method)">- (Object) <strong>concatenate_and_tag_assets</strong>(paths, variant = nil) </a>
    

    
  </span>
  
  
  <span class="note title private">private</span>
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>In order to support embedded assets from relative paths, we need to
expand the paths before contatenating the <span class="caps">CSS</span> together and losing the
location of the original stylesheet path.</p></div></span>
  
</li>

      
        <li class="private ">
  <span class="summary_signature">
    
      <a href="#construct_asset_path-instance_method" title="#construct_asset_path (instance method)">- (Object) <strong>construct_asset_path</strong>(asset_path, css_path, variant) </a>
    

    
  </span>
  
  
  <span class="note title private">private</span>
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Return a rewritten asset <span class="caps">URL</span> for a new stylesheet &#8212; the asset should
be tagged for embedding if embeddable, and referenced at the correct level
if relative.</p></div></span>
  
</li>

      
        <li class="private ">
  <span class="summary_signature">
    
      <a href="#embeddable%3F-instance_method" title="#embeddable? (instance method)">- (Boolean) <strong>embeddable?</strong>(asset_path, variant) </a>
    

    
  </span>
  
  
  <span class="note title private">private</span>
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>An asset is valid for embedding if it exists, is less than 32K, and is
stored somewhere inside of a folder named &#8220;embed&#8221;.</p></div></span>
  
</li>

      
        <li class="private ">
  <span class="summary_signature">
    
      <a href="#encoded_contents-instance_method" title="#encoded_contents (instance method)">- (Object) <strong>encoded_contents</strong>(asset_path) </a>
    

    
  </span>
  
  
  <span class="note title private">private</span>
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Return the Base64-encoded contents of an asset on a single line.</p></div></span>
  
</li>

      
        <li class="private ">
  <span class="summary_signature">
    
      <a href="#find_base_path-instance_method" title="#find_base_path (instance method)">- (Object) <strong>find_base_path</strong>(paths) </a>
    

    
  </span>
  
  
  <span class="note title private">private</span>
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Given a set of paths, find a common prefix path.</p></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#initialize-instance_method" title="#initialize (instance method)">- (Compressor) <strong>initialize</strong> </a>
    

    
  </span>
  
    <span class="note title constructor">constructor</span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>The css compressor is always the <span class="caps">YUI</span> Compressor.</p></div></span>
  
</li>

      
        <li class="private ">
  <span class="summary_signature">
    
      <a href="#mime_type-instance_method" title="#mime_type (instance method)">- (Object) <strong>mime_type</strong>(asset_path) </a>
    

    
  </span>
  
  
  <span class="note title private">private</span>
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Grab the mime-type of an asset, by filename.</p></div></span>
  
</li>

      
        <li class="private ">
  <span class="summary_signature">
    
      <a href="#rails_asset_id-instance_method" title="#rails_asset_id (instance method)">- (Object) <strong>rails_asset_id</strong>(path) </a>
    

    
  </span>
  
  
  <span class="note title private">private</span>
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Similar to the AssetTagHelper&#8217;s method of the same name, this will
determine the correct asset id for a file.</p></div></span>
  
</li>

      
        <li class="private ">
  <span class="summary_signature">
    
      <a href="#read_binary_file-instance_method" title="#read_binary_file (instance method)">- (Object) <strong>read_binary_file</strong>(path) </a>
    

    
  </span>
  
  
  <span class="note title private">private</span>
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>`File.read`, but in &#8220;binary&#8221; mode.</p></div></span>
  
</li>

      
        <li class="private ">
  <span class="summary_signature">
    
      <a href="#relative_path-instance_method" title="#relative_path (instance method)">- (Object) <strong>relative_path</strong>(absolute_path) </a>
    

    
  </span>
  
  
  <span class="note title private">private</span>
  
  
  

  
    <span class="summary_desc"><div class='inline'><p><span class="caps">CSS</span> assets that are referenced by relative paths, and are <strong>not</strong> being
embedded, must be rewritten relative to the newly-merged stylesheet path.</p></div></span>
  
</li>

      
        <li class="private ">
  <span class="summary_signature">
    
      <a href="#rewrite_asset_path-instance_method" title="#rewrite_asset_path (instance method)">- (Object) <strong>rewrite_asset_path</strong>(path, file_path) </a>
    

    
  </span>
  
  
  <span class="note title private">private</span>
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Similar to the AssetTagHelper&#8217;s method of the same name, this will
append the RAILS_ASSET_ID cache-buster to URLs, if it&#8217;s defined.</p></div></span>
  
</li>

      
        <li class="private ">
  <span class="summary_signature">
    
      <a href="#template_name-instance_method" title="#template_name (instance method)">- (Object) <strong>template_name</strong>(path, base_path) </a>
    

    
  </span>
  
  
  <span class="note title private">private</span>
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Determine the name of a JS template.</p></div></span>
  
</li>

      
        <li class="private ">
  <span class="summary_signature">
    
      <a href="#with_data_uris-instance_method" title="#with_data_uris (instance method)">- (Object) <strong>with_data_uris</strong>(css) </a>
    

    
  </span>
  
  
  <span class="note title private">private</span>
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Re-write all enabled asset URLs in a stylesheet with their corresponding
Data-<span class="caps">URI</span> Base-64 encoded asset contents.</p></div></span>
  
</li>

      
        <li class="private ">
  <span class="summary_signature">
    
      <a href="#with_mhtml-instance_method" title="#with_mhtml (instance method)">- (Object) <strong>with_mhtml</strong>(css, asset_url) </a>
    

    
  </span>
  
  
  <span class="note title private">private</span>
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Re-write all enabled asset URLs in a stylesheet with the <span class="caps">MHTML</span> equivalent.</p></div></span>
  
</li>

      
    </ul>
  

<div id="constructor_details" class="method_details_list">
  <h2>Constructor Details</h2>
  
    <div class="method_details first">
  <p class="signature first" id="initialize-instance_method">
  
    - (<tt><span class='object_link'><a href="" title="Ram::Compressor (class)">Compressor</a></span></tt>) <strong>initialize</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>The css compressor is always the <span class="caps">YUI</span> Compressor. JS compression can be
provided with <span class="caps">YUI</span> Compressor, Google Closure Compiler or UglifyJS.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


58
59
60
61
62
63
64</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/compressor.rb', line 58</span>

<span class='kw'>def</span> <span class='id initialize'>initialize</span>
  <span class='const'>Ram</span><span class='period'>.</span><span class='id check_java_version'>check_java_version</span>
  <span class='ivar'>@css_compressor</span> <span class='op'>=</span> <span class='const'>YUI</span><span class='op'>::</span><span class='const'>CssCompressor</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='const'>Ram</span><span class='period'>.</span><span class='id css_compressor_options'>css_compressor_options</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='id flavor'>flavor</span>          <span class='op'>=</span> <span class='const'>Ram</span><span class='period'>.</span><span class='id javascript_compressor'>javascript_compressor</span> <span class='op'>||</span> <span class='const'>Ram</span><span class='op'>::</span><span class='const'>DEFAULT_COMPRESSOR</span>
  <span class='ivar'>@options</span>        <span class='op'>=</span> <span class='const'>DEFAULT_OPTIONS</span><span class='lbracket'>[</span><span class='id flavor'>flavor</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id merge'>merge</span><span class='lparen'>(</span><span class='const'>Ram</span><span class='period'>.</span><span class='id compressor_options'>compressor_options</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='ivar'>@js_compressor</span>  <span class='op'>=</span> <span class='const'>COMPRESSORS</span><span class='lbracket'>[</span><span class='id flavor'>flavor</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='ivar'>@options</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
  
</div>


  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>
    
    
      <div class="method_details first">
  <p class="signature first" id="absolute_path-instance_method">
  
    - (<tt>Object</tt>) <strong>absolute_path</strong>(asset_pathname, css_pathname)  <span class="extras">(private)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Get the site-absolute public path for an asset file path that may or may
not be relative, given the path of the stylesheet that contains it.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


188
189
190
191
192</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/compressor.rb', line 188</span>

<span class='kw'>def</span> <span class='id absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='id asset_pathname'>asset_pathname</span><span class='comma'>,</span> <span class='id css_pathname'>css_pathname</span><span class='rparen'>)</span>
  <span class='lparen'>(</span><span class='id asset_pathname'>asset_pathname</span><span class='period'>.</span><span class='id absolute?'>absolute?</span> <span class='op'>?</span>
    <span class='const'>Pathname</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='const'>Ram</span><span class='period'>.</span><span class='id public_root'>public_root</span><span class='comma'>,</span> <span class='id asset_pathname'>asset_pathname</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='op'>:</span>
    <span class='id css_pathname'>css_pathname</span><span class='period'>.</span><span class='id dirname'>dirname</span> <span class='op'>+</span> <span class='id asset_pathname'>asset_pathname</span><span class='rparen'>)</span><span class='period'>.</span><span class='id cleanpath'>cleanpath</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="compile_jst-instance_method">
  
    - (<tt>Object</tt>) <strong>compile_jst</strong>(paths) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Compiles a single <span class="caps">JST</span> file by writing out a javascript that adds
template properties to a top-level template namespace object. Adds a
<span class="caps">JST</span>-compilation function to the top of the package, unless you&#8217;ve
specified your own preferred function, or turned it off.
<span class="caps">JST</span> templates are named with the basename of their file.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


97
98
99
100
101
102
103
104
105
106
107
108
109
110</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/compressor.rb', line 97</span>

<span class='kw'>def</span> <span class='id compile_jst'>compile_jst</span><span class='lparen'>(</span><span class='id paths'>paths</span><span class='rparen'>)</span>
  <span class='id namespace'>namespace</span>   <span class='op'>=</span> <span class='const'>Ram</span><span class='period'>.</span><span class='id template_namespace'>template_namespace</span>
  <span class='id paths'>paths</span>       <span class='op'>=</span> <span class='id paths'>paths</span><span class='period'>.</span><span class='id grep'>grep</span><span class='lparen'>(</span><span class='const'>Ram</span><span class='period'>.</span><span class='id template_extension_matcher'>template_extension_matcher</span><span class='rparen'>)</span><span class='period'>.</span><span class='id sort'>sort</span>
  <span class='id base_path'>base_path</span>   <span class='op'>=</span> <span class='id find_base_path'>find_base_path</span><span class='lparen'>(</span><span class='id paths'>paths</span><span class='rparen'>)</span>
  <span class='id compiled'>compiled</span>    <span class='op'>=</span> <span class='id paths'>paths</span><span class='period'>.</span><span class='id map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id path'>path</span><span class='op'>|</span>
    <span class='id contents'>contents</span>  <span class='op'>=</span> <span class='id read_binary_file'>read_binary_file</span><span class='lparen'>(</span><span class='id path'>path</span><span class='rparen'>)</span>
    <span class='id contents'>contents</span>  <span class='op'>=</span> <span class='id contents'>contents</span><span class='period'>.</span><span class='id gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\r?\n</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\\n</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>'</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>\\\\\'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
    <span class='id name'>name</span>      <span class='op'>=</span> <span class='id template_name'>template_name</span><span class='lparen'>(</span><span class='id path'>path</span><span class='comma'>,</span> <span class='id base_path'>base_path</span><span class='rparen'>)</span>
    <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id namespace'>namespace</span><span class='rbrace'>}</span><span class='tstring_content'>['</span><span class='embexpr_beg'>#{</span><span class='id name'>name</span><span class='rbrace'>}</span><span class='tstring_content'>'] = </span><span class='embexpr_beg'>#{</span><span class='const'>Ram</span><span class='period'>.</span><span class='id template_function'>template_function</span><span class='rbrace'>}</span><span class='tstring_content'>('</span><span class='embexpr_beg'>#{</span><span class='id contents'>contents</span><span class='rbrace'>}</span><span class='tstring_content'>');</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>end</span>
  <span class='id compiler'>compiler</span> <span class='op'>=</span> <span class='const'>Ram</span><span class='period'>.</span><span class='id include_jst_script'>include_jst_script</span> <span class='op'>?</span> <span class='id read_binary_file'>read_binary_file</span><span class='lparen'>(</span><span class='const'>DEFAULT_JST_SCRIPT</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='semicolon'>;</span>
  <span class='id setup_namespace'>setup_namespace</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id namespace'>namespace</span><span class='rbrace'>}</span><span class='tstring_content'> = </span><span class='embexpr_beg'>#{</span><span class='id namespace'>namespace</span><span class='rbrace'>}</span><span class='tstring_content'> || {};</span><span class='tstring_end'>&quot;</span></span>
  <span class='lbracket'>[</span><span class='const'>JST_START</span><span class='comma'>,</span> <span class='id setup_namespace'>setup_namespace</span><span class='comma'>,</span> <span class='id compiler'>compiler</span><span class='comma'>,</span> <span class='id compiled'>compiled</span><span class='comma'>,</span> <span class='const'>JST_END</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id flatten'>flatten</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="compress_css-instance_method">
  
    - (<tt>Object</tt>) <strong>compress_css</strong>(paths, variant = nil, asset_url = nil) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Concatenate and compress a list of <span class="caps">CSS</span> stylesheets. When compressing a
:datauri or :mhtml variant, post-processes the result to embed
referenced assets.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


80
81
82
83
84
85
86
87
88
89
90</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/compressor.rb', line 80</span>

<span class='kw'>def</span> <span class='id compress_css'>compress_css</span><span class='lparen'>(</span><span class='id paths'>paths</span><span class='comma'>,</span> <span class='id variant'>variant</span><span class='op'>=</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id asset_url'>asset_url</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
  <span class='ivar'>@asset_contents</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
  <span class='id css'>css</span> <span class='op'>=</span> <span class='id concatenate_and_tag_assets'>concatenate_and_tag_assets</span><span class='lparen'>(</span><span class='id paths'>paths</span><span class='comma'>,</span> <span class='id variant'>variant</span><span class='rparen'>)</span>
  <span class='id css'>css</span> <span class='op'>=</span> <span class='ivar'>@css_compressor</span><span class='period'>.</span><span class='id compress'>compress</span><span class='lparen'>(</span><span class='id css'>css</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='const'>Ram</span><span class='period'>.</span><span class='id compress_assets'>compress_assets</span>
  <span class='kw'>case</span> <span class='id variant'>variant</span>
  <span class='kw'>when</span> <span class='kw'>nil</span>      <span class='kw'>then</span> <span class='kw'>return</span> <span class='id css'>css</span>
  <span class='kw'>when</span> <span class='symbol'>:datauri</span> <span class='kw'>then</span> <span class='kw'>return</span> <span class='id with_data_uris'>with_data_uris</span><span class='lparen'>(</span><span class='id css'>css</span><span class='rparen'>)</span>
  <span class='kw'>when</span> <span class='symbol'>:mhtml</span>   <span class='kw'>then</span> <span class='kw'>return</span> <span class='id with_mhtml'>with_mhtml</span><span class='lparen'>(</span><span class='id css'>css</span><span class='comma'>,</span> <span class='id asset_url'>asset_url</span><span class='rparen'>)</span>
  <span class='kw'>else</span> <span class='id raise'>raise</span> <span class='const'>PackageNotFound</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\&quot;</span><span class='embexpr_beg'>#{</span><span class='id variant'>variant</span><span class='rbrace'>}</span><span class='tstring_content'>\&quot; is not a valid stylesheet variant</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="compress_js-instance_method">
  
    - (<tt>Object</tt>) <strong>compress_js</strong>(paths) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Concatenate together a list of JavaScript paths, and pass them through the
<span class="caps">YUI</span> Compressor (with munging enabled). <span class="caps">JST</span> can optionally be included.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


68
69
70
71
72
73
74
75</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/compressor.rb', line 68</span>

<span class='kw'>def</span> <span class='id compress_js'>compress_js</span><span class='lparen'>(</span><span class='id paths'>paths</span><span class='rparen'>)</span>
  <span class='kw'>if</span> <span class='lparen'>(</span><span class='id jst_paths'>jst_paths</span> <span class='op'>=</span> <span class='id paths'>paths</span><span class='period'>.</span><span class='id grep'>grep</span><span class='lparen'>(</span><span class='const'>Ram</span><span class='period'>.</span><span class='id template_extension_matcher'>template_extension_matcher</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id empty?'>empty?</span>
    <span class='id js'>js</span> <span class='op'>=</span> <span class='id concatenate'>concatenate</span><span class='lparen'>(</span><span class='id paths'>paths</span><span class='rparen'>)</span>
  <span class='kw'>else</span>
    <span class='id js'>js</span> <span class='op'>=</span> <span class='id concatenate'>concatenate</span><span class='lparen'>(</span><span class='id paths'>paths</span> <span class='op'>-</span> <span class='id jst_paths'>jst_paths</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='id compile_jst'>compile_jst</span><span class='lparen'>(</span><span class='id jst_paths'>jst_paths</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
  <span class='const'>Ram</span><span class='period'>.</span><span class='id compress_assets'>compress_assets</span> <span class='op'>?</span> <span class='ivar'>@js_compressor</span><span class='period'>.</span><span class='id compress'>compress</span><span class='lparen'>(</span><span class='id js'>js</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id js'>js</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="concatenate-instance_method">
  
    - (<tt>Object</tt>) <strong>concatenate</strong>(paths)  <span class="extras">(private)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Concatenate together a list of asset files.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


243
244
245</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/compressor.rb', line 243</span>

<span class='kw'>def</span> <span class='id concatenate'>concatenate</span><span class='lparen'>(</span><span class='id paths'>paths</span><span class='rparen'>)</span>
  <span class='lbracket'>[</span><span class='id paths'>paths</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id flatten'>flatten</span><span class='period'>.</span><span class='id map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id p'>p</span><span class='op'>|</span> <span class='id read_binary_file'>read_binary_file</span><span class='lparen'>(</span><span class='id p'>p</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="concatenate_and_tag_assets-instance_method">
  
    - (<tt>Object</tt>) <strong>concatenate_and_tag_assets</strong>(paths, variant = nil)  <span class="extras">(private)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>In order to support embedded assets from relative paths, we need to
expand the paths before contatenating the <span class="caps">CSS</span> together and losing the
location of the original stylesheet path. Validate the assets while we&#8217;re
at it.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


140
141
142
143
144
145
146
147
148
149
150</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/compressor.rb', line 140</span>

<span class='kw'>def</span> <span class='id concatenate_and_tag_assets'>concatenate_and_tag_assets</span><span class='lparen'>(</span><span class='id paths'>paths</span><span class='comma'>,</span> <span class='id variant'>variant</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
  <span class='id stylesheets'>stylesheets</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id paths'>paths</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id flatten'>flatten</span><span class='period'>.</span><span class='id map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id css_path'>css_path</span><span class='op'>|</span>
    <span class='id contents'>contents</span> <span class='op'>=</span> <span class='id read_binary_file'>read_binary_file</span><span class='lparen'>(</span><span class='id css_path'>css_path</span><span class='rparen'>)</span>
    <span class='id contents'>contents</span><span class='period'>.</span><span class='id gsub'>gsub</span><span class='lparen'>(</span><span class='const'>EMBED_DETECTOR</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id url'>url</span><span class='op'>|</span>
      <span class='id ipath'>ipath</span><span class='comma'>,</span> <span class='id cpath'>cpath</span> <span class='op'>=</span> <span class='const'>Pathname</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='backref'>$1</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='const'>Pathname</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id expand_path'>expand_path</span><span class='lparen'>(</span><span class='id css_path'>css_path</span><span class='rparen'>)</span><span class='rparen'>)</span>
      <span class='id is_url'>is_url</span> <span class='op'>=</span> <span class='const'>URI</span><span class='period'>.</span><span class='id parse'>parse</span><span class='lparen'>(</span><span class='backref'>$1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id absolute?'>absolute?</span>
      <span class='id is_url'>is_url</span> <span class='op'>?</span> <span class='id url'>url</span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>url(</span><span class='embexpr_beg'>#{</span><span class='id construct_asset_path'>construct_asset_path</span><span class='lparen'>(</span><span class='id ipath'>ipath</span><span class='comma'>,</span> <span class='id cpath'>cpath</span><span class='comma'>,</span> <span class='id variant'>variant</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>&quot;</span></span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>
  <span class='id stylesheets'>stylesheets</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="construct_asset_path-instance_method">
  
    - (<tt>Object</tt>) <strong>construct_asset_path</strong>(asset_path, css_path, variant)  <span class="extras">(private)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Return a rewritten asset <span class="caps">URL</span> for a new stylesheet &#8212; the asset should
be tagged for embedding if embeddable, and referenced at the correct level
if relative.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


179
180
181
182
183
184</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/compressor.rb', line 179</span>

<span class='kw'>def</span> <span class='id construct_asset_path'>construct_asset_path</span><span class='lparen'>(</span><span class='id asset_path'>asset_path</span><span class='comma'>,</span> <span class='id css_path'>css_path</span><span class='comma'>,</span> <span class='id variant'>variant</span><span class='rparen'>)</span>
  <span class='id public_path'>public_path</span> <span class='op'>=</span> <span class='id absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='id asset_path'>asset_path</span><span class='comma'>,</span> <span class='id css_path'>css_path</span><span class='rparen'>)</span>
  <span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>__EMBED__</span><span class='embexpr_beg'>#{</span><span class='id public_path'>public_path</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id embeddable?'>embeddable?</span><span class='lparen'>(</span><span class='id public_path'>public_path</span><span class='comma'>,</span> <span class='id variant'>variant</span><span class='rparen'>)</span>
  <span class='id source'>source</span> <span class='op'>=</span> <span class='id asset_path'>asset_path</span><span class='period'>.</span><span class='id absolute?'>absolute?</span> <span class='op'>?</span> <span class='id asset_path'>asset_path</span><span class='period'>.</span><span class='id to_s'>to_s</span> <span class='op'>:</span> <span class='id relative_path'>relative_path</span><span class='lparen'>(</span><span class='id public_path'>public_path</span><span class='rparen'>)</span>
  <span class='id rewrite_asset_path'>rewrite_asset_path</span><span class='lparen'>(</span><span class='id source'>source</span><span class='comma'>,</span> <span class='id public_path'>public_path</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="embeddable?-instance_method">
  
    - (<tt>Boolean</tt>) <strong>embeddable?</strong>(asset_path, variant)  <span class="extras">(private)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>An asset is valid for embedding if it exists, is less than 32K, and is
stored somewhere inside of a folder named &#8220;embed&#8221;. IE does not support
Data-URIs larger than 32K, and you probably shouldn&#8217;t be embedding assets
that large in any case. Because we need to check the base64 length here,
save it so that we don&#8217;t have to compute it again later.</p>

  </div>
</div>
<div class="tags">
  
<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Boolean</tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


220
221
222
223
224
225
226
227
228</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/compressor.rb', line 220</span>

<span class='kw'>def</span> <span class='id embeddable?'>embeddable?</span><span class='lparen'>(</span><span class='id asset_path'>asset_path</span><span class='comma'>,</span> <span class='id variant'>variant</span><span class='rparen'>)</span>
  <span class='id font'>font</span> <span class='op'>=</span> <span class='const'>EMBED_FONTS</span><span class='period'>.</span><span class='id include?'>include?</span><span class='lparen'>(</span><span class='id asset_path'>asset_path</span><span class='period'>.</span><span class='id extname'>extname</span><span class='rparen'>)</span>
  <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='id variant'>variant</span>
  <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='id asset_path'>asset_path</span><span class='period'>.</span><span class='id to_s'>to_s</span><span class='period'>.</span><span class='id match'>match</span><span class='lparen'>(</span><span class='const'>EMBEDDABLE</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='id asset_path'>asset_path</span><span class='period'>.</span><span class='id exist?'>exist?</span>
  <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='const'>EMBED_EXTS</span><span class='period'>.</span><span class='id include?'>include?</span><span class='lparen'>(</span><span class='id asset_path'>asset_path</span><span class='period'>.</span><span class='id extname'>extname</span><span class='rparen'>)</span>
  <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='id font'>font</span> <span class='op'>||</span> <span class='id encoded_contents'>encoded_contents</span><span class='lparen'>(</span><span class='id asset_path'>asset_path</span><span class='rparen'>)</span><span class='period'>.</span><span class='id length'>length</span> <span class='op'>&lt;</span> <span class='const'>MAX_IMAGE_SIZE</span>
  <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>if</span> <span class='id font'>font</span> <span class='op'>&amp;&amp;</span> <span class='id variant'>variant</span> <span class='op'>==</span> <span class='symbol'>:mhtml</span>
  <span class='kw'>return</span> <span class='kw'>true</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="encoded_contents-instance_method">
  
    - (<tt>Object</tt>) <strong>encoded_contents</strong>(asset_path)  <span class="extras">(private)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Return the Base64-encoded contents of an asset on a single line.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


231
232
233
234
235</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/compressor.rb', line 231</span>

<span class='kw'>def</span> <span class='id encoded_contents'>encoded_contents</span><span class='lparen'>(</span><span class='id asset_path'>asset_path</span><span class='rparen'>)</span>
  <span class='kw'>return</span> <span class='ivar'>@asset_contents</span><span class='lbracket'>[</span><span class='id asset_path'>asset_path</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='ivar'>@asset_contents</span><span class='lbracket'>[</span><span class='id asset_path'>asset_path</span><span class='rbracket'>]</span>
  <span class='id data'>data</span> <span class='op'>=</span> <span class='id read_binary_file'>read_binary_file</span><span class='lparen'>(</span><span class='id asset_path'>asset_path</span><span class='rparen'>)</span>
  <span class='ivar'>@asset_contents</span><span class='lbracket'>[</span><span class='id asset_path'>asset_path</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='const'>Base64</span><span class='period'>.</span><span class='id encode64'>encode64</span><span class='lparen'>(</span><span class='id data'>data</span><span class='rparen'>)</span><span class='period'>.</span><span class='id gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\n</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="find_base_path-instance_method">
  
    - (<tt>Object</tt>) <strong>find_base_path</strong>(paths)  <span class="extras">(private)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Given a set of paths, find a common prefix path.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


116
117
118
119
120
121
122
123
124
125
126
127</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/compressor.rb', line 116</span>

<span class='kw'>def</span> <span class='id find_base_path'>find_base_path</span><span class='lparen'>(</span><span class='id paths'>paths</span><span class='rparen'>)</span>
  <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id paths'>paths</span><span class='period'>.</span><span class='id length'>length</span> <span class='op'>&lt;=</span> <span class='int'>1</span>
  <span class='id paths'>paths</span><span class='period'>.</span><span class='id sort!'>sort!</span>
  <span class='id first'>first</span> <span class='op'>=</span> <span class='id paths'>paths</span><span class='period'>.</span><span class='id first'>first</span><span class='period'>.</span><span class='id split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
  <span class='id last'>last</span>  <span class='op'>=</span> <span class='id paths'>paths</span><span class='period'>.</span><span class='id last'>last</span><span class='period'>.</span><span class='id split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
  <span class='id i'>i</span> <span class='op'>=</span> <span class='int'>0</span>
  <span class='kw'>while</span> <span class='id first'>first</span><span class='lbracket'>[</span><span class='id i'>i</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='id last'>last</span><span class='lbracket'>[</span><span class='id i'>i</span><span class='rbracket'>]</span> <span class='op'>&amp;&amp;</span> <span class='id i'>i</span> <span class='op'>&lt;=</span> <span class='id first'>first</span><span class='period'>.</span><span class='id length'>length</span>
    <span class='id i'>i</span> <span class='op'>+=</span> <span class='int'>1</span>
  <span class='kw'>end</span>
  <span class='id res'>res</span> <span class='op'>=</span> <span class='id first'>first</span><span class='period'>.</span><span class='id slice'>slice</span><span class='lparen'>(</span><span class='int'>0</span><span class='comma'>,</span> <span class='id i'>i</span><span class='rparen'>)</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
  <span class='id res'>res</span><span class='period'>.</span><span class='id empty?'>empty?</span> <span class='op'>?</span> <span class='kw'>nil</span> <span class='op'>:</span> <span class='id res'>res</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="mime_type-instance_method">
  
    - (<tt>Object</tt>) <strong>mime_type</strong>(asset_path)  <span class="extras">(private)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Grab the mime-type of an asset, by filename.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


238
239
240</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/compressor.rb', line 238</span>

<span class='kw'>def</span> <span class='id mime_type'>mime_type</span><span class='lparen'>(</span><span class='id asset_path'>asset_path</span><span class='rparen'>)</span>
  <span class='const'>EMBED_MIME_TYPES</span><span class='lbracket'>[</span><span class='const'>File</span><span class='period'>.</span><span class='id extname'>extname</span><span class='lparen'>(</span><span class='id asset_path'>asset_path</span><span class='rparen'>)</span><span class='rbracket'>]</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="rails_asset_id-instance_method">
  
    - (<tt>Object</tt>) <strong>rails_asset_id</strong>(path)  <span class="extras">(private)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Similar to the AssetTagHelper&#8217;s method of the same name, this will
determine the correct asset id for a file.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


209
210
211
212
213</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/compressor.rb', line 209</span>

<span class='kw'>def</span> <span class='id rails_asset_id'>rails_asset_id</span><span class='lparen'>(</span><span class='id path'>path</span><span class='rparen'>)</span>
  <span class='id asset_id'>asset_id</span> <span class='op'>=</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>RAILS_ASSET_ID</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
  <span class='kw'>return</span> <span class='id asset_id'>asset_id</span> <span class='kw'>if</span> <span class='id asset_id'>asset_id</span>
  <span class='const'>File</span><span class='period'>.</span><span class='id exists?'>exists?</span><span class='lparen'>(</span><span class='id path'>path</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='const'>File</span><span class='period'>.</span><span class='id mtime'>mtime</span><span class='lparen'>(</span><span class='id path'>path</span><span class='rparen'>)</span><span class='period'>.</span><span class='id to_i'>to_i</span><span class='period'>.</span><span class='id to_s'>to_s</span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="read_binary_file-instance_method">
  
    - (<tt>Object</tt>) <strong>read_binary_file</strong>(path)  <span class="extras">(private)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>`File.read`, but in &#8220;binary&#8221; mode.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


248
249
250</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/compressor.rb', line 248</span>

<span class='kw'>def</span> <span class='id read_binary_file'>read_binary_file</span><span class='lparen'>(</span><span class='id path'>path</span><span class='rparen'>)</span>
  <span class='const'>File</span><span class='period'>.</span><span class='id open'>open</span><span class='lparen'>(</span><span class='id path'>path</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>rb:UTF-8</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id f'>f</span><span class='op'>|</span> <span class='id f'>f</span><span class='period'>.</span><span class='id read'>read</span> <span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="relative_path-instance_method">
  
    - (<tt>Object</tt>) <strong>relative_path</strong>(absolute_path)  <span class="extras">(private)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p><span class="caps">CSS</span> assets that are referenced by relative paths, and are <strong>not</strong> being
embedded, must be rewritten relative to the newly-merged stylesheet path.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


196
197
198</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/compressor.rb', line 196</span>

<span class='kw'>def</span> <span class='id relative_path'>relative_path</span><span class='lparen'>(</span><span class='id absolute_path'>absolute_path</span><span class='rparen'>)</span>
  <span class='const'>File</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>../</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id absolute_path'>absolute_path</span><span class='period'>.</span><span class='id sub'>sub</span><span class='lparen'>(</span><span class='const'>Ram</span><span class='period'>.</span><span class='id public_root'>public_root</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="rewrite_asset_path-instance_method">
  
    - (<tt>Object</tt>) <strong>rewrite_asset_path</strong>(path, file_path)  <span class="extras">(private)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Similar to the AssetTagHelper&#8217;s method of the same name, this will
append the RAILS_ASSET_ID cache-buster to URLs, if it&#8217;s defined.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


202
203
204
205</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/compressor.rb', line 202</span>

<span class='kw'>def</span> <span class='id rewrite_asset_path'>rewrite_asset_path</span><span class='lparen'>(</span><span class='id path'>path</span><span class='comma'>,</span> <span class='id file_path'>file_path</span><span class='rparen'>)</span>
  <span class='id asset_id'>asset_id</span> <span class='op'>=</span> <span class='id rails_asset_id'>rails_asset_id</span><span class='lparen'>(</span><span class='id file_path'>file_path</span><span class='rparen'>)</span>
  <span class='lparen'>(</span><span class='op'>!</span><span class='id asset_id'>asset_id</span> <span class='op'>||</span> <span class='id asset_id'>asset_id</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id path'>path</span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id path'>path</span><span class='rbrace'>}</span><span class='tstring_content'>?</span><span class='embexpr_beg'>#{</span><span class='id asset_id'>asset_id</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="template_name-instance_method">
  
    - (<tt>Object</tt>) <strong>template_name</strong>(path, base_path)  <span class="extras">(private)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Determine the name of a JS template. If there&#8217;s a common base path, use
the namespaced prefix. Otherwise, simply use the filename.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


131
132
133
134</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/compressor.rb', line 131</span>

<span class='kw'>def</span> <span class='id template_name'>template_name</span><span class='lparen'>(</span><span class='id path'>path</span><span class='comma'>,</span> <span class='id base_path'>base_path</span><span class='rparen'>)</span>
  <span class='kw'>return</span> <span class='const'>File</span><span class='period'>.</span><span class='id basename'>basename</span><span class='lparen'>(</span><span class='id path'>path</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.</span><span class='embexpr_beg'>#{</span><span class='const'>Ram</span><span class='period'>.</span><span class='id template_extension'>template_extension</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id base_path'>base_path</span>
  <span class='id path'>path</span><span class='period'>.</span><span class='id gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\A</span><span class='embexpr_beg'>#{</span><span class='const'>Regexp</span><span class='period'>.</span><span class='id escape'>escape</span><span class='lparen'>(</span><span class='id base_path'>base_path</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='tstring_content'>\/(.*)\.</span><span class='embexpr_beg'>#{</span><span class='const'>Ram</span><span class='period'>.</span><span class='id template_extension'>template_extension</span><span class='rbrace'>}</span><span class='tstring_content'>\Z</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>\1</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="with_data_uris-instance_method">
  
    - (<tt>Object</tt>) <strong>with_data_uris</strong>(css)  <span class="extras">(private)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Re-write all enabled asset URLs in a stylesheet with their corresponding
Data-<span class="caps">URI</span> Base-64 encoded asset contents.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


154
155
156
157
158</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/compressor.rb', line 154</span>

<span class='kw'>def</span> <span class='id with_data_uris'>with_data_uris</span><span class='lparen'>(</span><span class='id css'>css</span><span class='rparen'>)</span>
  <span class='id css'>css</span><span class='period'>.</span><span class='id gsub'>gsub</span><span class='lparen'>(</span><span class='const'>EMBED_REPLACER</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id url'>url</span><span class='op'>|</span>
    <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>url(\&quot;data:</span><span class='embexpr_beg'>#{</span><span class='id mime_type'>mime_type</span><span class='lparen'>(</span><span class='backref'>$1</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='tstring_content'>;charset=utf-8;base64,</span><span class='embexpr_beg'>#{</span><span class='id encoded_contents'>encoded_contents</span><span class='lparen'>(</span><span class='backref'>$1</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='tstring_content'>\&quot;)</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="with_mhtml-instance_method">
  
    - (<tt>Object</tt>) <strong>with_mhtml</strong>(css, asset_url)  <span class="extras">(private)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Re-write all enabled asset URLs in a stylesheet with the <span class="caps">MHTML</span> equivalent.
The newlines (&#8220;\r\n&#8221;) in the following method are critical. Without them
your <span class="caps">MHTML</span> will look identical, but won&#8217;t work.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


163
164
165
166
167
168
169
170
171
172
173
174</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/compressor.rb', line 163</span>

<span class='kw'>def</span> <span class='id with_mhtml'>with_mhtml</span><span class='lparen'>(</span><span class='id css'>css</span><span class='comma'>,</span> <span class='id asset_url'>asset_url</span><span class='rparen'>)</span>
  <span class='id paths'>paths</span><span class='comma'>,</span> <span class='id index'>index</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='int'>0</span>
  <span class='id css'>css</span> <span class='op'>=</span> <span class='id css'>css</span><span class='period'>.</span><span class='id gsub'>gsub</span><span class='lparen'>(</span><span class='const'>EMBED_REPLACER</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id url'>url</span><span class='op'>|</span>
    <span class='id i'>i</span> <span class='op'>=</span> <span class='id paths'>paths</span><span class='lbracket'>[</span><span class='backref'>$1</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id index'>index</span> <span class='op'>+=</span> <span class='int'>1</span><span class='rbrace'>}</span><span class='tstring_content'>-</span><span class='embexpr_beg'>#{</span><span class='const'>File</span><span class='period'>.</span><span class='id basename'>basename</span><span class='lparen'>(</span><span class='backref'>$1</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
    <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>url(mhtml:</span><span class='embexpr_beg'>#{</span><span class='id asset_url'>asset_url</span><span class='rbrace'>}</span><span class='tstring_content'>!</span><span class='embexpr_beg'>#{</span><span class='id i'>i</span><span class='rbrace'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>end</span>
  <span class='id mhtml'>mhtml</span> <span class='op'>=</span> <span class='id paths'>paths</span><span class='period'>.</span><span class='id sort'>sort</span><span class='period'>.</span><span class='id map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id path'>path</span><span class='comma'>,</span> <span class='id identifier'>identifier</span><span class='op'>|</span>
    <span class='id mime'>mime</span><span class='comma'>,</span> <span class='id contents'>contents</span> <span class='op'>=</span> <span class='id mime_type'>mime_type</span><span class='lparen'>(</span><span class='id path'>path</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id encoded_contents'>encoded_contents</span><span class='lparen'>(</span><span class='id path'>path</span><span class='rparen'>)</span>
    <span class='lbracket'>[</span><span class='const'>MHTML_SEPARATOR</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Content-Location: </span><span class='embexpr_beg'>#{</span><span class='id identifier'>identifier</span><span class='rbrace'>}</span><span class='tstring_content'>\r\n</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Content-Type: </span><span class='embexpr_beg'>#{</span><span class='id mime'>mime</span><span class='rbrace'>}</span><span class='tstring_content'>\r\n</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Content-Transfer-Encoding: base64\r\n\r\n</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id contents'>contents</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\r\n</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
  <span class='kw'>end</span>
  <span class='lbracket'>[</span><span class='const'>MHTML_START</span><span class='comma'>,</span> <span class='id mhtml'>mhtml</span><span class='comma'>,</span> <span class='const'>MHTML_END</span><span class='comma'>,</span> <span class='id css'>css</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id flatten'>flatten</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>
    
    <div id="footer">
  Generated on Mon Oct 24 22:09:16 2011 by 
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.7.3 (ruby-1.9.2).
</div>

  </body>
</html>